package hotciv.tools;

import hotciv.framework.Game;
import hotciv.framework.Position;
import hotciv.view.GfxConstants;

import java.awt.event.MouseEvent;

import minidraw.framework.DrawingEditor;
import minidraw.standard.NullTool;

public class UnitActionTool extends NullTool
{
	private Game game;
	
	public UnitActionTool(Game g, DrawingEditor editor)
	{
		this.game = g;
	}
	
	public void mouseUp(MouseEvent e, int x, int y)
	{
		if(e.isShiftDown() && game.getUnitAt(GfxConstants.getPositionFromXY(x, y)) != null)
		{
			Position position = GfxConstants.getPositionFromXY(x, y);
			game.performUnitActionAt(position);
		}
	}
	
}
